Update the max folder and the max account version.
authorCamila Ayres <hello@camilasan.com>
Thu, 16 Jan 2025 22:38:01 +0000 (23:38 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Tue, 11 Feb 2025 09:57:01 +0000 (10:57 +0100)
Improve log output when migrating settings.

Signed-off-by: Camila Ayres <hello@camilasan.com>
src/gui/accountmanager.cpp
src/gui/application.cpp
src/gui/folder.h
src/gui/folderman.cpp

index 36f6110821bd5d9b4a8b603dda0ca8bfb934c070..0a3c40cbc6dbee9965686e2c00fb972f1a1a265d 100644 (file)
@@ -78,8 +78,8 @@ constexpr auto unbrandedRelativeConfigLocationC = "/Nextcloud/nextcloud.cfg";
 constexpr auto unbrandedCfgFileNameC = "nextcloud.cfg";
 
 // The maximum versions that this client can read
-constexpr auto maxAccountsVersion = 2;
-constexpr auto maxAccountVersion = 1;
+constexpr auto maxAccountsVersion = 13;
+constexpr auto maxAccountVersion = 13;
 
 constexpr auto serverHasValidSubscriptionC = "serverHasValidSubscription";
 }
@@ -150,6 +150,9 @@ void AccountManager::backwardMigrationSettingsKeys(QStringList *deleteKeys, QStr
     const auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC));
     const auto accountsVersion = settings->value(QLatin1String(versionC)).toInt();
 
+    qCInfo(lcAccountManager) << "Checking for accounts versions.";
+    qCInfo(lcAccountManager) << "Config accounts version:" << accountsVersion;
+    qCInfo(lcAccountManager) << "Max accounts Version is set to:" << maxAccountsVersion;
     if (accountsVersion <= maxAccountsVersion) {
         const auto settingsChildGroups = settings->childGroups();
         for (const auto &accountId : settingsChildGroups) {
@@ -158,6 +161,7 @@ void AccountManager::backwardMigrationSettingsKeys(QStringList *deleteKeys, QStr
 
             if (accountVersion > maxAccountVersion) {
                 ignoreKeys->append(settings->group());
+                qCInfo(lcAccountManager) << "Ignoring account" << accountId << "because of version" << accountVersion;
             }
             settings->endGroup();
         }
index 641f32c749cf6eda8261cced59f6bdc9bd7e27e4..080ad34e63af0ae70c1f3f11557599478908092e 100644 (file)
@@ -144,6 +144,7 @@ bool Application::configVersionMigration()
     const auto downgrading = previousVersion > currentVersion;
 
     if (versionChanged) {
+        qCInfo(lcApplication) << "Version changed. Removing updater settings from config.";
         configFile.cleanUpdaterConfiguration();
     }
 
@@ -198,13 +199,16 @@ bool Application::configVersionMigration()
             QTimer::singleShot(0, qApp, &QCoreApplication::quit);
             return false;
         }
+    }
 
+    if (!deleteKeys.isEmpty()) {
         auto settings = ConfigFile::settingsWithGroup("foo");
         settings->endGroup();
 
         // Wipe confusing keys from the future, ignore the others
         for (const auto &badKey : std::as_const(deleteKeys)) {
             settings->remove(badKey);
+            qCInfo(lcApplication) << "Migration: removed" << badKey << "key from settings.";
         }
     }
 
index 7b1b53929223e5a8c9e12a2d20de2b3fe80802cb..741ce76b10dfa1264c3695a024f6868ff59f218d 100644 (file)
@@ -85,8 +85,9 @@ public:
      *            (version remains readable by 2.5.1)
      * Version 3: introduction of new windows vfs mode in 2.6.0
      * Version 5: available in oC client 4.0.0 and 4.2.0
+     * Version 13: available in oC client 5.2.0 and 5.3.1
      */
-    static int maxSettingsVersion() { return 5; }
+    static int maxSettingsVersion() { return 13; }
 
     /// Ensure / as separator and trailing /.
     static QString prepareLocalPath(const QString &path);
index 69c7dfeab836e2b715e45bd918dd1104b9391d2d..9b279bbb0d00be2714002364a908670aba741534 100644 (file)
@@ -388,16 +388,19 @@ void FolderMan::backwardMigrationSettingsKeys(QStringList *deleteKeys, QStringLi
     auto processSubgroup = [&](const QString &name) {
         settings->beginGroup(name);
         const auto foldersVersion = settings->value(QLatin1String(settingsVersionC), 1).toInt();
+        qCInfo(lcFolderMan) << "FolderDefinition::maxSettingsVersion:" << FolderDefinition::maxSettingsVersion();
         if (foldersVersion <= maxFoldersVersion) {
             for (const auto &folderAlias : settings->childGroups()) {
                 settings->beginGroup(folderAlias);
                 const auto folderVersion = settings->value(QLatin1String(settingsVersionC), 1).toInt();
                 if (folderVersion > FolderDefinition::maxSettingsVersion()) {
+                    qCInfo(lcFolderMan) << "Ignoring folder:" << folderAlias << "version:" << folderVersion;
                     ignoreKeys->append(settings->group());
                 }
                 settings->endGroup();
             }
         } else {
+            qCInfo(lcFolderMan) << "Ignoring group:" << name << "version:" << foldersVersion;
             deleteKeys->append(settings->group());
         }
         settings->endGroup();